package de.tydejay.lazysms.server;

import java.util.ArrayList;
import java.util.List;

import com.google.appengine.api.users.User;
import com.google.appengine.api.users.UserServiceFactory;
import com.google.gwt.user.server.rpc.RemoteServiceServlet;

import de.tydejay.lazysms.client.UserService;
import de.tydejay.lazysms.server.dao.UserDAO;
import de.tydejay.lazysms.shared.LoginObjectDTO;

/**
 * The server side implementation of the RPC service.
 */
@SuppressWarnings("serial")
public class UserServiceImpl extends RemoteServiceServlet implements
		UserService {
	
	@Override
	public LoginObjectDTO getUserObject(String path) throws IllegalArgumentException {
		User currentUser = UserServiceFactory.getUserService().getCurrentUser();
		
		if (currentUser == null) {
			return new LoginObjectDTO(UserServiceFactory.getUserService().createLoginURL(path));
		} else {
			UserDAO dao = new UserDAO();
			return new LoginObjectDTO(dao.getUserDTO(currentUser));
		}
	}
	
	
	
	//DUMMYS - Bitte nicht entfernen!!!
	org.datanucleus.sco.backed.List nucleusListe = null;
	org.datanucleus.sco.backed.ArrayList nucleusArrayListe = null;
}
